package com.rd.student.jike.class4.wanghaixin.test0727;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class TestFile06 {
    //编码问题
    public static void main(String[] args) throws UnsupportedEncodingException {
        String data = "a我a";
        byte[] bytes = data.getBytes();//默认是按照频台字符集（UTF-8)进行解码的
        System.out.println(Arrays.toString(bytes));

        //按照指定字符集进行解码
        byte[] byte1 = data.getBytes("GBK");
        System.out.println(Arrays.toString(byte1));

        //解码
        String s1 = new String(bytes);
        System.out.println(s1);

        String s2 = new String(byte1,"GBK");
        System.out.println(s2);
    }

}
